package com.ball.dev.controller;




import com.ball.common.dtos.ResponseResult;
import com.ball.dev.service.IFileService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件
 * </p>
 *
 * @author lou
 * @since 2023-12-07
 */
@RestController
@RequestMapping("/files")
@RequiredArgsConstructor
public class FileController {

    private final IFileService fileService;

    @PostMapping("/file")
    public ResponseResult uploadFile(
             @RequestParam("file")MultipartFile file){
        return fileService.uploadFile(file);
    }



    @DeleteMapping("/{id}")
    public void deleteFileById(
             @PathVariable("id") String id) {
        fileService.removeById(id);
    }
}
